USE [IntTester]
GO

/****** Object:  StoredProcedure [dbo].[pr_GetTestRunStatusCount_Chart]    Script Date: 03/10/2014 16:40:22 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[pr_GetTestRunStatusCount_Chart]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[pr_GetTestRunStatusCount_Chart]
GO

USE [IntTester]
GO

/****** Object:  StoredProcedure [dbo].[pr_GetTestRunStatusCount_Chart]    Script Date: 03/10/2014 16:40:22 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
create PROCEDURE [dbo].[pr_GetTestRunStatusCount_Chart]
	-- Add the parameters for the stored procedure here
	@testName nvarchar(500)
AS
BEGIN
	
	
	IF @testName=''
	BEGIN
		SELECT     TestName, SUM(Passed) AS Passed, SUM(Failed) AS Failed, SUM(Error) AS Error
		FROM         dbo.vw_TestRunStatusCountGrouped
		GROUP BY TestName
	
	
	END
	ELSE
	BEGIN
	
		SELECT     TestName, SUM(Passed) AS Passed, SUM(Failed) AS Failed, SUM(Error) AS Error
		FROM         dbo.vw_TestRunStatusCountGrouped
		WHERE TestName=@testName
		GROUP BY TestName
	
	END
	
	
	
	
END



GO


